package org.example.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * <p> AOP </p>
 *
 * @author Chris
 * @since 2022/10/25 22:51
 */
@Component
@Aspect
public class LogAop {

	@Pointcut("execution(* org.example.service.*.*(..))")
	public void pointCut() {

	}

	@Before("pointCut()")
	public void beforeMethod(JoinPoint joinPoint) {
		System.out.println("前置通知：" + joinPoint);
	}

	@After("pointCut()")
	public void afterMethod(JoinPoint joinPoint) {
		System.out.println("后置通知：" + joinPoint);
	}


}